package com.cjkj.system.api.factory;

import com.cjkj.common.core.domain.R;
import com.cjkj.system.api.RemoteAppService;
import com.cjkj.system.api.domain.dto.APIWechatSessionDto;
import com.cjkj.system.api.domain.request.APIAppAccountReq;
import com.cjkj.system.api.model.AppletLoginUser;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * 小程序服务降级
 */
public class RemoteAppFallbackFactory implements FallbackFactory<RemoteAppService> {
    @Override
    public RemoteAppService create(Throwable cause) {
        return new RemoteAppService() {
            @Override
            public R<APIWechatSessionDto> getOpenId(String jsCode, String dataType) {
                return R.fail("获取OpenId失败");
            }

            @Override
            public R<AppletLoginUser> getLoginUser(String openid) {
                return R.fail("获取登录用户信息失败");
            }

            @Override
            public R<?> addAccount(APIAppAccountReq accountReq) {
                return R.fail("注册失败");
            }

            @Override
            public R<?> clearDoctorInfo(String doctorAccount, String source) {
                return R.fail("操作失败");
            }
        };
    }
}